package cn.lls.excel;

import cn.lls.excel.converter.MaritalConverter;
import cn.lls.excel.converter.SexConverter;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import lombok.Data;

import java.net.URL;
import java.util.Date;

/**
 * 员工信息导出为Excel的实体类
 *
 * @ClassName EmployeeExcel
 * @Author 划水艺术家
 * @Date 2022/11/22 2:08
 * @Version 1.0
 **/

@Data
@ContentRowHeight(50)
public class EmployeeExcel {

    /**
     * 用户主键，自增
     */
    @ExcelProperty(value = "id")
    @ColumnWidth(8)
    private Long userId;

    /**
     * 员工姓名
     */
    @ExcelProperty( value = "姓名")
//    @ExcelProperty(index = 1, value = "姓名")
    @ColumnWidth(15)
    private String employeeName;

    /**
     * 部门名
     */
    @ExcelProperty(value = "部门")
    @ColumnWidth(20)
    private String departmentName;

    /**
     * 角色名，即职位名
     */
    @ExcelProperty(value = "职位")
    @ColumnWidth(20)
    private String roleName;

    /**
     * 员工性别 0 女 1 男
     * 使用 自定义SexConvertor 完成转换
     */
    @ExcelProperty(value = "性别", converter = SexConverter.class)
    @ColumnWidth(8)
    private Integer employeeGender;

    /**
     * 员工图片地址，全地址
     */
    @ExcelProperty(value = "照片")
    @ColumnWidth(15)
    private URL employeeImage;

    /**
     * 员工联系电话
     */
    @ExcelProperty(value = "电话")
    @ColumnWidth(20)
    private String employeeTel;

    /**
     * 员工联系邮箱
     */
    @ExcelProperty( value = "邮箱")
    @ColumnWidth(20)
    private String employeeEmail;

    /**
     * 员工学历
     */
    @ExcelProperty( value = "学历")
    @ColumnWidth(10)
    private String employeeDegree;

    /**
     * 员工民族
     */
    @ExcelProperty(value = "民族")
    @ColumnWidth(10)
    private String employeeEthnic;

    /**
     * 员工是否结婚 0：否 1：是
     */
    @ExcelProperty( value = "婚烟状况", converter = MaritalConverter.class)
    @ColumnWidth(10)
    private Integer employeeMarital;

    /**
     * 员工入职日期
     */
    @DateTimeFormat("yyyy-MM-dd")
    @ExcelProperty(value = "入职日期")
    @ColumnWidth(18)
    private Date joinDate ;

     /**
     * 员工出生日期
     */
    @DateTimeFormat("yyyy-MM-dd")
    @ExcelProperty(value = "出生日期")
    @ColumnWidth(18)
    private Date birthDate ;

}
